package com.ruoyi.project.user.partner.service.impl;

import com.ruoyi.project.user.partner.domain.Partner;
import com.ruoyi.project.user.partner.mapper.PartnerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PartnerServiceImpl implements com.ruoyi.project.user.partner.service.PartnerService {
    @Autowired
    private PartnerMapper partnerMapper;
    @Override
    public List<Partner> showPartner(Partner partner) {
        return partnerMapper.selectByPartner(partner);
    }

    @Override
    public Long checkNet(String partnerNet) {
        return partnerMapper.checkNet(partnerNet);
    }

    @Override
    public int insert(Partner partner) {
        int index = partnerMapper.insertPartner(partner);
        if(index>0) {
            return 1;
        }
        return 0;
    }

    @Override
    public int delete(Long[] ids) {
        int index = partnerMapper.deleteByIds(ids);
        if (index>0){
            return 1;
        }

        return 0;
    }

    @Override
    public Partner showPartnerById(Long partnerId) {
        return partnerMapper.selectBypartnerId(partnerId);
    }

    @Override
    public int updatePartner(Partner partner) {
        int index = partnerMapper.updateHostByPartnerId(partner);
        if (index>0){
            return 1;
        }
        return 0;
    }
}
